/***
 * 
 * <div id="swiftui-formId">
 * 	  <script src="FormController.js" type="text/javascript"/>
 * </div>
 * 
 * 
 * 
 */





var formUrl = "/services/formcontroller/template?formId=${formId}";

formUrl = SwiftUI.generateFrameworkUrl(formUrl);

$.getJSON(formUrl, function(data) {
	//var fieldHtmls = [];

	var formId = data.formId;
	var formDivId = "swiftui-"+formId;
	/**
	 * Iterate over Form fields
	 */
	$.each(data.fields, function(index, field) {
		$("#"+formDivId).append(SwiftUI.renderTemplateBasic("swiftui-formtemplate-"
				+ field.fieldType, field));
		if(field.fieldType == "SLIDER"){
			$("#"+formId+"-"+field.fieldId).slider({min:field.minValue});
		}else if(field.fieldType == "PROGRESSBAR"){
			
		}
		
		
	});

	/*$('<ul/>', {
		'class' : 'my-new-list',
		html : items.join('')
	}).appendTo('body');*/
});

/**
 * 
 * 
 * <script type="text/x-tmpl" id="swiftui-formtemplate-TEXTBOX"> 
 * 		<input type="text" id="{%=o.formId%}_{%=o.fieldId%}"></input> 
 * </script>
 * 
 * 
 * 
 */
